package com.tuanzi.loan.schedule.receipt;

import com.base.common.http.HttpClientUtil;
import com.base.common.http.model.RequestHeader;
import com.base.common.log.LogService;
import com.tuanzi.loan.core.aspect.Debug;
import com.tuanzi.server.loan_base.util.DateUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* @Description:    调度统计接口
* @Author:         xionghao
* @CreateDate:     2019/1/9
*/
@Debug
@Slf4j
@Service
@Transactional
public class StatisticsRegisterNumScheduler {

    @Value("${loan.registernum.stat.url}")
    private String url;

    /**
     * 每小时调度一次分时注册统计接口
     */
    @Scheduled(cron = "${cron.statistics.hour.registernum}")
    public void StatRegisterNumData(){
        LogService.info("调度分时统计注册数接口开始");
        try {
            HttpClientUtil.get(new RequestHeader(),String.format(url, DateUtils.getCurrentDate()));
        } catch (Exception e) {
            LogService.error("请求分时注册统计接口异常",e);
        }

        LogService.info("调度分时统计注册数接口结束");
    }
}
